package com.project.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.project.bean.SellOrderBean;
import com.project.service.ISellOrderService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;

/**
 * 销售车订单控制器
 */

@RestController
@RequestMapping("sellOrder")
@RequiresPermissions("sellInfo:am")
public class SellOrderController {
    @Autowired
    private ISellOrderService sellOrderService;
    @RequestMapping("cutSellOrderByItem")
    public IPage<SellOrderBean> cutSellOrderByItem(Integer pageNO, String clientName, LocalDate startDate, LocalDate endDate){
        return sellOrderService.cutSellOrderByItem(pageNO, clientName, startDate, endDate);
    }

    /**
     * 通过销售订单ID，查询销售详情。同时查询销售明细信息，在销售明细信息中，需要查询商品名称和品牌
     * @param sellOrderId 销售订单ID
     * @return  销售订单对象
     */
    @RequestMapping("findSellOrderById")
    public SellOrderBean findSellOrderById(Integer sellOrderId){
        return sellOrderService.findSellOrderById(sellOrderId);
    }
}
